package com.example.yrdev.ordering_system.http;

import android.app.Application;
import android.content.Context;
import android.os.Handler;

//import com.uuzuche.lib_zxing.activity.ZXingLibrary;

import java.util.concurrent.TimeUnit;

import okhttp3.OkHttpClient;


public class AppContext extends Application {

    private static AppContext app;

    public AppContext() {
        app = this;
    }

    public static synchronized AppContext getInstance() {
        if (app == null) {
            app = new AppContext();
        }
        return app;
    }


    //SP名称
    public static final String PREFERENCE_NAME="meihaodiqiucun";
    public static Application application;
    public static Handler mHandler;
    public static Context mcontext;
    @Override
    public void onCreate() {
        super.onCreate();
        mHandler=new Handler();
        application=this;
        mcontext=this;
      //  ZXingLibrary.initDisplayOpinion(this);
        registerUncaughtExceptionHandler();

        OkHttpClient okHttpClient = new OkHttpClient.Builder()
//                .addInterceptor(new LoggerInterceptor("TAG"))
                .connectTimeout(10000L, TimeUnit.MILLISECONDS)
                .readTimeout(10000L, TimeUnit.MILLISECONDS)
                //其他配置
                .build();


    }
    // 注册App异常崩溃处理器
    private void registerUncaughtExceptionHandler() {
        //  Thread.setDefaultUncaughtExceptionHandler(AppException.getAppExceptionHandler());
    }
}